package org.nerve.data.neo4j.domain;

import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Relationship;
import org.nerve.data.neo4j.domain.relation.Friend;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * org.nerve.data.neo4j.domain
 * Created by zengxm on 12/13/2016.
 */
@NodeEntity(label = "Account")
public class Account extends BaseEntity{
	private String uuid;
	private int site;
	private String name;
	private String url;

	public Account(){}

	public Account(int site,String uuid,String name){
		this.site=site;
		this.uuid=uuid;
		this.name=name;
	}
	public Account(String uuid){
		this.uuid=uuid;
	}

	@Relationship(type = "FRIEND", direction = Relationship.INCOMING)
	private Set<Friend> friends=new HashSet<>();

	public Set<Friend> getFriends() {
		return friends;
	}

	public Account setFriends(Set<Friend> friends) {
		this.friends = friends;
		return this;
	}

	public String getUuid() {
		return uuid;
	}

	public Account setUuid(String uuid) {
		this.uuid = uuid;
		return this;
	}

	public int getSite() {
		return site;
	}

	public Account setSite(int site) {
		this.site = site;
		return this;
	}

	public String getName() {
		return name;
	}

	public Account setName(String name) {
		this.name = name;
		return this;
	}

	public String getUrl() {
		return url;
	}

	public Account setUrl(String url) {
		this.url = url;
		return this;
	}

	/**
	 *
	 * @param account
	 */
	public void addFriend(final Account account){
		friends.add(new Friend(account, this));
	}
}
